// import axios from 'axios'

module.exports = {
	state: { 
		count: 1,
		users: []
	},
	mutations: {
		increment(state) {
			state.count++;
		},
		addUser(state, users) {
			// state.users.push({"name": "zhangsan"})
			state.users.splice(0, state.users.length);
			state.users.push(...users)
		}
	},
	actions: {
		loadUsers({commit}) {
			return new Promise((resolve, reject) => {
				setTimeout(()=>{
					commit('addUser', [{"name":"zhangsan"}, {"name": "lisi"}]);
					resolve()
				}, 2000)
			})
		}
	}
}
